/*
 * @Author: zwc 6537397+uni-yunApp@user.noreply.gitee.com
 * @Date: 2023-03-15 11:39:48
 * @LastEditors: zwc 6537397+uni-yunApp@user.noreply.gitee.com
 * @LastEditTime: 2023-03-16 15:01:13
 * @FilePath: \project-template\vite.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig,loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import basicSsl from '@vitejs/plugin-basic-ssl'
import { resolve } from 'path'

// 自动按需引入
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

// https://vitejs.dev/config/
export default defineConfig(({mode})=>{
  const env = loadEnv(mode, process.cwd(), 'VITE_')
 return {
  plugins: [
    vue(), 
    basicSsl(),
    AutoImport({imports: ["vue", "vue-router"],resolvers: [ElementPlusResolver()],
    }),
    Components({resolvers: [ElementPlusResolver()],
    }),
  ],
  // 设置别名
 resolve:{
  alias:{
    '@':resolve(__dirname,'src')
  }
 },
 server: {
  host: env.VITE_HOST_NAME,
  port: 8552,
  https: true
}
 }
})
